<template>
  <h1>El-开关组件</h1>
  <el-switch v-model="isShow"></el-switch>
  <!-- 开关只支持布尔类型的值
  如果想要扩展为数字或字符串类型，需要设置active-value和inactive-value属性来控制 -->
  <el-switch v-model="value1" :active-value="1" :inactive-value="0"></el-switch>
  <el-switch v-model="value2" :active-value="'1'" :inactive-value="'0'"></el-switch>
  <el-switch v-model="value2" active-value="1" inactive-value="0" @change="f"></el-switch>
</template>

<script setup>
import {ref} from "vue";

const isShow = ref(true);
const value1 = ref(1);
const value2 = ref('1');
const f = () =>{
  console.log('开关状态被修改了!');
}
</script>

<style scoped>

</style>